/*****************************************************************************
 *
 *                      HUSONG PROPRIETARY INFORMATION
 *
 *          The information contained herein is proprietary to HUSONG
 *           and shall not be reproduced or disclosed in whole or in part
 *                    or used for any design or manufacture
 *              without direct written authorization from HUSONG.
 *
 *            Copyright (c) 2015 by HUSONG.  All rights reserved.
 *
 *****************************************************************************/
package me.send.produce.client.controller.base;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.UnknownHostException;

import me.send.business.service.service.OrdersService;
import me.send.business.service.service.WalletService;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author maxmin
 *
 * @date 2015年8月3日 下午5:50:58
 */
public class BaseController {
	
	@Autowired
	protected WalletService walletService;
	@Autowired
	protected OrdersService orderService;
	
	
	/**
	 * 保存异常信息
	 * 
	 * @param authorName
	 * @param modelName
	 * @param functionName
	 * @param e
	 */
	@SuppressWarnings("unused")
	protected void saveException(String authorName, String modelName,
			String functionName, Exception e) {
		
		try {
			// Exception的具体说明
			ByteArrayOutputStream baos = new ByteArrayOutputStream();  
	        e.printStackTrace(new PrintStream(baos));  
	        String exception = baos.toString();  
			
	        // 获得当前的IP地址
			InetAddress addr = InetAddress.getLocalHost();
			String ip=addr.getHostAddress().toString();//获得本机IP
			
		} catch (UnknownHostException e1) {
			e1.printStackTrace();
		}
		
	}
}
